#!/bin/bash

echo 'run maven from docker --------'
docker run --rm \
 -v $(pwd):/build \
 -v /tmp/m2:/root/.m2 \
 maven:3-jdk-8-alpine \
 mvn clean package --settings /build/maven-aliyun.xml -f /build/pom.xml


#network
docker network create spring-net &>/dev/null

#run test
docker run --rm \
--name=ms-eureka \
-h=ms-eureka \
--net=spring-net \
-p 8761:8761 \
-v $(pwd):/build  \
openjdk:8-alpine  \
java \
-server \
-Duser.timezone=PRC  \
-Deureka.environment=dev \
-Deureka.client.register-with-eureka=false \
-Deureka.client.fetch-registry=false \
-jar /build/target/ms-eureka.jar
